﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Project_KhuyenMaiVang.Models;
using Project_KhuyenMaiVang.DataProvider;
using System.Data.SqlClient;
using System.Data;

namespace Project_KhuyenMaiVang.DAO
{
    public class LoaiSanPhamDAO : MyDataProvider
    {
        /// <summary>
        /// Lấy tất cả các loại sản phẩm
        /// </summary>
        /// <returns>List LoaiSanPhamDTO</returns>
        public List<LoaiSanPhamDTO> GetListLoaiSanPhamDTO()
        {
            List<LoaiSanPhamDTO> result = new List<LoaiSanPhamDTO>();
            LoaiSanPhamDTO adder;
            string QueryString = @"select * from LoaiSanPham";
            this._DataReader = this.executeQuery(QueryString);
            while (this._DataReader.Read())
            {
                adder = new LoaiSanPhamDTO(this._DataReader.GetInt32(0), this._DataReader.GetString(1));
                result.Add(adder);
            }
            return result;
        }
    }
}